package com.nbufe.controller;

import com.nbufe.domain.ResponseResult;
import com.nbufe.domain.dto.ModifyElectricHeatInfoDto;
import com.nbufe.domain.dto.ModifyFossiFuelInfoDto;
import com.nbufe.domain.form.QueryElectricHeatForm;
import com.nbufe.domain.vo.ElectricHeatBuyInfoVo;
import com.nbufe.domain.vo.electricheat.CalcElectricHeatCarbonVo;
import com.nbufe.service.ElectricHeatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author LZH
 * @date 2023/4/3
 */
@CrossOrigin
@Api(tags = "电力热力模块接口")
@RestController
@RequestMapping("/electricHeat")
public class ElectricHeatController {

    @Resource
    private ElectricHeatService electricHeatService;

    @ApiOperation("分页条件查询")
    @PostMapping("/pageList")
    public ResponseResult pageList(@RequestBody QueryElectricHeatForm form) {
        return electricHeatService.pageList(form);
    }

    @ApiOperation("批量/单个删除电力热力")
    @DeleteMapping("/delete")
    public ResponseResult deleteFossiFuel(@RequestBody List<Integer> ids) {
        return electricHeatService.deleteOneOrBatch(ids);
    }

    @ApiOperation("查询电力热力存在的所有年份")
    @GetMapping("/years")
    public ResponseResult getAllYears() {
        return electricHeatService.getAllYears();
    }

    @ApiOperation("修改电力热力购入信息")
    @PutMapping("/modify")
    public ResponseResult modifyFossiFuelInfo(@RequestBody ModifyElectricHeatInfoDto dto) {
        return electricHeatService.modifyElectricHeatInfo(dto);
    }

    @ApiOperation("计算指定年指定月指定购入产品的CO2")
    @PutMapping("/calcYearMonthElectricHeat")
    public ResponseResult calcYearMonthDayElectricHeat(@RequestBody CalcElectricHeatCarbonVo vo) {
        return electricHeatService.calcYearMonthElectricHeat(vo);
    }

    @ApiOperation("添加电力热力购入信息")
    @PostMapping("/add")
    public ResponseResult addElectricHeat(@RequestBody ElectricHeatBuyInfoVo vo) {
        return electricHeatService.addElectricHeatBuyInfo(vo);
    }
}
